package com.mall.controller;

import com.mall.entity.User;
import com.mall.service.UserService;
import com.mall.utils.StringUtils;
import com.mall.vo.ResultVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.jws.soap.SOAPBinding;
import java.util.Objects;
@CrossOrigin
@RestController
@RequestMapping("/user")
public class UserController {
    @Autowired
    private UserService userService;
    @GetMapping("/login")
    public ResultVO userLogin(String username,String password){
        User user = new User();
        user.setPassword(password);
        user.setUsername(username);
        return userService.userLogin(user);
    }
    @PostMapping("/regist")
    public ResultVO userRegist(@RequestBody User user){

        System.out.println(user);
        return userService.userRegist(user);
    }
}
